﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace BLL.SysManage
{
    public partial class T_PUB_MATERIALTYPE
    {
        private readonly DALL.SysManage.T_PUB_MATERIALTYPE dal = new DALL.SysManage.T_PUB_MATERIALTYPE();
        public T_PUB_MATERIALTYPE()
        { }

        /// <summary>
        /// 智能提示元素类型名称
        /// </summary>
        /// <returns></returns>
        public DataSet GetMaterialTypeName()
        {
            return dal.GetMaterialTypeName();
        }

        #region  Method

        /// <summary>
        /// 获得下级元素类型
        /// </summary>
        /// <param name="strPIPD">父ID</param>
        /// <param name="strNmae">名称</param>
        /// <returns></returns>
        public List<Model.SysManage.T_PUB_MATERIALTYPE> GetNxtElementtMent(string strPIPD, string strNmae)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("ISUSED='1'");
            if (strPIPD != "0")
            {
                strSql.Append(string.Format(" and PARENT_ID='{0}'", strPIPD));
            }
            if (!string.IsNullOrEmpty(strNmae))
            {
                strSql.Append(string.Format(" and TYPE_NAME like'%{0}%'", strNmae));
            }
            return GetModelList(strSql.ToString());
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.SysManage.T_PUB_MATERIALTYPE model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.SysManage.T_PUB_MATERIALTYPE model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int TYPE_ID)
        {

            return dal.Delete(TYPE_ID);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.SysManage.T_PUB_MATERIALTYPE GetModel(int TYPE_ID)
        {

            return dal.GetModel(TYPE_ID);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Model.SysManage.T_PUB_MATERIALTYPE> GetModelList(string strWhere)
        {
            return dal.GetListArray(strWhere); ;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Model.SysManage.T_PUB_MATERIALTYPE> GetLibraryInListArray(string IDs)
        {
            string strWhere = "";
            if (IDs!="")
            {
                strWhere = string.Format(" FALG in ( {0} )", IDs);
            }
            return dal.GetLibraryInListArray(strWhere);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }
       
        #endregion  Method
    }
}
